﻿using System.Reflection;

namespace Borg
{
    internal class AddContractTask : Task<Repository>
    {
        private readonly ContractInfo _contractInfo;

        public AddContractTask(Repository obj, ContractInfo contractInfo,
            uint taskGroupId, Assembly initiator)
            : base(obj, taskGroupId, initiator)
        {
            _contractInfo = contractInfo;
        }

        public override void Execute()
        {
            obj.InternalAddContract(_contractInfo, taskGroupId);
        }

        public override string ToString()
        {
            return string.Format("{0}: Repository.InternalAddContract({1})", taskGroupId, _contractInfo);
        }

        public override string Name
        {
            get { return string.Format("AddContract({0})", _contractInfo.Name); }
        }
    }
}

